package com.ilxqx.framework.rc;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 打印HelloWorld
 * @author venus
 */
@Component
@Slf4j
public class FrameworkInfoPrinter implements CommandLineRunner {

    private static final String DEV = "dev";
    @Value("${spring.profiles.active}")
    private String active;

    /**
     * Callback used to run the bean.
     *
     * @param args incoming main method arguments
     * @throws Exception on error
     */
    @Override
    public void run(String... args) throws Exception {
        // 启动内网穿透
        if (StringUtils.equalsIgnoreCase(DEV, this.active)) {
            Runtime.getRuntime().exec("/Users/venus/IdeaProjects/quick-start-framework/natapp/natapp --authtoken 0e0919de1f177f92");
            log.info("内网穿透启动成功");
        }
        log.info("欢迎使用超级无敌牛逼的Framework框架！");
        log.info("本框架由Venus一人历经无数个日夜、头脑风暴、不断改进和完善的快速开发框架");
        log.info("如有任何疑问，可给我邮件[{}]", "iweixiaopeng@163.com");
    }

}
